package bll

import (
	"7qule.com/sd3/CrossServer/src/bll/challenge/dal"
	"7qule.com/sd3/CrossServer/src/bll/world"
)

// 擂台排行榜长度Model务逻辑类
type baseChallengeLeaderboardLenModelBll struct {
	// 擂台排行榜长度Model数据
	data int
}

// --------------------------------初始化--------------------------------------------------

// 擂台排行榜长度Model逻辑类
var BaseChallengeLeaderboardLenModelBll = &baseChallengeLeaderboardLenModelBll{}

// 初始化
func init() {
	// 注册数据初始化函数
	world.LoadMgr.RegisterFunc(BaseChallengeLeaderboardLenModelBll.StructName(), BaseChallengeLeaderboardLenModelBll.initData)
}

// StructName 模块名
func (this *baseChallengeLeaderboardLenModelBll) StructName() string {
	return "BaseChallengeLeaderboardLenModelBll"
}

// initData 初始化数据
// 返回值:
// err:错误Model
func (this *baseChallengeLeaderboardLenModelBll) initData() (errList []error) {
	tempList, err := dal.BaseChallengeLeaderboardLenModelDal.GetData()
	if err != nil {
		errList = append(errList, err)
		return
	}

	this.data = tempList[0].LeaderboardLen

	return
}

// --------------------------------生成的基础方法--------------------------------------------------

// GetData 获取数据
// 返回值:
// []*GlobalChallengeLeaderboardLen:获取到的擂台排行榜长度信息数据
func (this *baseChallengeLeaderboardLenModelBll) GetData() int {
	return this.data
}
